﻿using System;

using System.Collections.Generic;
using System.Text;
using Silvermoon.OpenGL.Native;
using System.Drawing;

namespace Silvermoon.Shapes
{
    public enum StopType : short
    {
        /// <summary>
        /// The offset is relative to the range between Start and Stop.
        /// </summary>
        Relative = 0,

        /// <summary>
        /// The offset is absolute in pixel.
        /// </summary>
        Absolute = 1
    };

    public struct GradientStop
    {
        public short Offset;
        public GlColor Color;
        public StopType Type;

        public GradientStop(short offset, GlColor color)
        {
            Offset = offset;
            Color = color;
            Type = StopType.Relative;
        }

        public GradientStop(short offset, GlColor color, StopType type)
        {
            Offset = offset;
            Color = color;
            Type = type;
        }

        public GradientStop(short offset, Color color)
        {
            GlColor glc = color;
            glc.SwapRB();
            this.Offset = offset;
            this.Color = glc.Value;
            Type = StopType.Relative;
        }

        public GradientStop(short offset, int a, int r, int g, int b)
        {
            GlColor glc = new GlColor();
            glc.A = (byte)a;
            glc.B = (byte)b;
            glc.G = (byte)g;
            glc.R = (byte)r;

            Color = glc;
            Offset = offset;
            Type = StopType.Relative;
        }

    }
}
